package com.maomao.config;

/**
 * @author mao
 * @date 2025-06-10- 14:00
 * @descript 4. 租户上下文管理
 */
public class TenantContext {

    private static final ThreadLocal<String> CURRENT_TENANT = new ThreadLocal<>();

    /**
     * 设置租户id
     * @author mao
     * @date 2025/6/10 14:40
     * @param tenantId
     */
    public static void setCurrentTenant(String tenantId) {
        CURRENT_TENANT.set(tenantId);
    }

    public static String getCurrentTenant() {
        return CURRENT_TENANT.get();
    }

    public static void clear() {
        CURRENT_TENANT.remove();
    }

}
